#pragma once

#include "Utility.h"

namespace My {

class Glyph
{
protected:
	CBitmap		m_Glyph;
	CBitmap		m_Mask;
	CSize		m_Size;
	CDC			m_DC;
	CDC			m_InvMaskDC;
public:
	Glyph();
	~Glyph();
public:
	CSize Size() const
		{ return m_Size; }
	int Width() const
		{ return m_Size.cx; }
	int Height() const
		{ return m_Size.cy; }
	CRect Bounds() const
		{ return CRect(CPoint(0, 0), Size()); }
public:
	virtual void Load(const char * szGlyph, const char * szMask = 0);
	void Draw(CDC * pDC, int x, int y, int align = ALIGN_HLEFT|ALIGN_VTOP);
	void Draw(CDC * pDC, const CRect & r, int align = ALIGN_CENTER);
	void DrawOverHere(CDC * pDC, int x, int y);
private:
	void UpdateAlpha();
};

class SysColorGlyph : public Glyph {
private:
	void UpdateColors();
public:
	virtual void Load(const char * szGlyph, const char * szMask = 0);
};

class GrayedGlyph : public Glyph {
private:
	void UpdateColors();
public:
	virtual void Load(const char * szGlyph, const char * szMask = 0);
};

} // My
